home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / netdmo.exe / USELOG2.FRM < prev    next >
Text File  |  1993-12-10  |  3KB  |  124 lines

  1. Version 1.00
  2. BEGIN Form Uselog2
  3.     AutoRedraw   = 0
  4.     BackColor    = QBColor(1)
  5.     BorderStyle  = 1
  6.     Caption      = "Login Script"
  7.     ControlBox   = -1
  8.     Enabled      = -1
  9.     ForeColor    = QBColor(0)
  10.     Height       = Char(18)
  11.     Left         = Char(9)
  12.     MaxButton    = -1
  13.     MinButton    = -1
  14.     MousePointer = 0
  15.     Tag          = ""
  16.     Top          = Char(3)
  17.     Visible      = -1
  18.     Width        = Char(63)
  19.     WindowState  = 0
  20.     BEGIN TextBox Script
  21.         BackColor    = QBColor(1)
  22.         BorderStyle  = 1
  23.         DragMode     = 0
  24.         Enabled      = -1
  25.         ForeColor    = QBColor(7)
  26.         Height       = Char(13)
  27.         Left         = Char(0)
  28.         MousePointer = 0
  29.         MultiLine    = -1
  30.         ScrollBars   = 0
  31.         TabIndex     = 1
  32.         TabStop      = -1
  33.         Tag          = ""
  34.         Text         = ""
  35.         Top          = Char(0)
  36.         Visible      = -1
  37.         Width        = Char(61)
  38.     END
  39.     BEGIN CommandButton Command1
  40.         BackColor    = QBColor(7)
  41.         Cancel       = 0
  42.         Caption      = "OK"
  43.         Default      = 0
  44.         DragMode     = 0
  45.         Enabled      = -1
  46.         Height       = Char(3)
  47.         Left         = Char(21)
  48.         MousePointer = 0
  49.         TabIndex     = 0
  50.         TabStop      = -1
  51.         Tag          = ""
  52.         Top          = Char(13)
  53.         Visible      = -1
  54.         Width        = Char(19)
  55.     END
  56. END
  57. DECLARE SUB Command1_Click ()
  58. '$FORM USELOG1
  59. COMMON SHARED Uname$
  60. COMMON SHARED UserID$
  61.  
  62. SUB Command1_Click ()
  63. UNLOAD uselog2
  64. USELOG1.SHOW
  65. END SUB
  66.  
  67. SUB Form_Load ()
  68. CRLF$ = CHR$(13) + CHR$(10)
  69. user$ = UserID$
  70. FOR i% = 1 TO 8                  'Remove any leading zeros from user ID
  71.     namelen% = LEN(user$)
  72.     x% = VAL(MID$(user$, 1, 1))
  73.     IF x% <> 0 THEN
  74.         EXIT FOR
  75.     ELSE
  76.         user$ = MID$(user$, i% + 1, namelen%)
  77.     END IF
  78. NEXT i%
  79.  
  80. filename$ = "Z:\mail\" + user$ + "\login"
  81. uselog2.caption = "              Login Script For: " + Uname$
  82.  
  83. ON LOCAL ERROR GOTO FileError
  84.  
  85. drivenow$ = CURDIR$                   'Check Network Drive
  86. CHDRIVE "Z"
  87. CHDRIVE drivenow$
  88.  
  89. OPEN filename$ FOR INPUT AS #1        'Read the Login Script
  90. DO WHILE NOT EOF(1)
  91. INPUT #1, linetext$
  92. linetext$ = linetext$ + CRLF$
  93. script.text = script.text + linetext$
  94. LOOP
  95. CLOSE #1
  96. GOTO last
  97.  
  98. FileError:
  99. errstring$ = ERROR$
  100. errtype% = INSTR(errstring$, "Device unavailable")
  101. IF errtype% > 0 THEN
  102.     msg$ = "There Is No Z: Drive. "
  103.     CHDRIVE drivenow$
  104.     script.text = "       This program assumes that there is a drive Z:  " + CRLF$ + CRLF$ + "               Click on 'OK' to Continue.   "
  105. END IF
  106. errtype% = INSTR(errstring$, "File not found")
  107. IF errtype% > 0 THEN
  108.     msg$ = "Either this user doesn't have a personal login script file, " + CRLF$ + "or you do not have rights for this operation."
  109.     script.text = "        Check your rights to the MAIL directory " + CRLF$ + "              Click on 'OK' to Continue.   "
  110. END IF
  111.  
  112. MSGBOX (msg$), 0, "Error Getting Script"
  113. RESUME recover
  114.  
  115. recover:
  116.  
  117. last:
  118. END SUB
  119.  
  120. SUB Form_Unload (Cancel AS INTEGER)
  121. USELOG1.SHOW
  122. END SUB
  123.  
  124.